revealer: emit notify::child-revealed when animation stops
authorMatthieu Gautier <matthieu.gautier@mgautier.fr>
Wed, 4 May 2016 10:42:40 +0000 (12:42 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 6 May 2016 20:09:12 +0000 (16:09 -0400)
Depending of float rounding during target calculation, the size of the
GtkRevealer can be set to zero will the animation is not finished.
If the GtkRevealer is in a GtkPaned, it will be hidden and so the animation
will be stopped before it is finished.

In this case, force the emission of the child-revealed signal to let
client code know the animation is finished.

https://bugzilla.gnome.org/show_bug.cgi?id=765973

gtk/gtkrevealer.c

index 49d9048dd2aa045ba4f5d8e1f3646b244769e565..b23f66a7e118420e610855142aad4809a6c4a58c 100644 (file)
@@ -632,8 +632,11 @@ static void
 gtk_revealer_stop_animation (GtkRevealer *revealer)
 {
   GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer);
-
-  priv->current_pos = priv->target_pos;
+  if (priv->current_pos != priv->target_pos)
+    {
+      priv->current_pos = priv->target_pos;
+      g_object_notify_by_pspec (G_OBJECT (revealer), props[PROP_CHILD_REVEALED]);
+    }
   if (priv->tick_id != 0)
     {
       gtk_widget_remove_tick_callback (GTK_WIDGET (revealer), priv->tick_id);